#coding=utf-8

#判断命令格式是否正确
def judge_command(string):
    #定义三个变量，分别检测字母、数字、特殊字符的个数
    alpha_count = 0
    number_count = 0
    other_count = 0
    alpha_bak = ['A','S','D','W']
    #如果长度小于1，代表命令为空，返回false
    if len(string) < 1:
        return False
    #记录字母、数字、特殊非'-'号特殊字符的个数
    if string[0].isdigit():
        return False
    for i in string:
        if i.isalpha():
            alpha_count += 1
        elif i.isdigit():
            number_count += 1
        elif i != '-':
            other_count += 1
    #如果格式正确，输出True，否则，输出Flase
    if alpha_count == 1 and string[0] in alpha_bak and number_count<=2 and number_count >= 1 and other_count == 0:
        return True
    else:
        return False

#坐标移动
def axis_move(command,axis):
    if command[1] == '-':
        number = 0 - int(command[2:])
    else:
        number = int(command[1:])
    if command[0] == 'A':
        axis[0] -= number
    elif command[0] == 'S':
        axis[1] -= number
    elif command[0] == 'D':
        axis[0] += number
    elif command[0] == 'W':
        axis[1] += number
    return axis

#主函数
def main():
    axis = [0,0]
    inputs = input()
    commands = inputs.split(';')
    for c in commands:
        if judge_command(c):
            axis = axis_move(c,axis)
    print(str(axis[0]) + ',' + str(axis[1]))
    return




if __name__ == '__main__':
    main()
# 写的很不错~